package com.twu.biblioteca.menu;

import com.twu.biblioteca.LibraryManager;
import com.twu.biblioteca.Messages;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Login implements MenuOption {

    @Override
    public void execute() {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        LibraryManager libraryManager = LibraryManager.getInstance();
        try {
            libraryManager.printToScreen(Messages.REQUEST_USER_NAME + " and " +Messages.REQUEST_USER_PASSWORD);
            libraryManager.authenticateUser(reader.readLine(), reader.readLine());
            libraryManager.printToScreen(libraryManager.getOutput());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
